package kz.pompei.ifacer.dialogs;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class ButtonDialogTester {
  public static void main(String[] args) {
    final JFrame f = new JFrame();
    f.setTitle("Проверка диалога");
    f.setBounds(100, 100, 800, 600);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        f.setVisible(true);
      }
    });
    
    JPanel pane = new JPanel();
    f.setContentPane(pane);
    
    JButton b = new JButton("Open");
    pane.add(b);
    
    b.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        ButtonDialog dia = new ButtonDialog(f, 111);
        dia.addMessage("Message 1 \\n hgfh gd hgfd hhgfdhgfdh g"
            + "fdh gfdhte hte htrehtr hrt ehr treht");
        dia.addMessage("Message 2");
        dia.addButton(122, "ret 122");
        dia.addDefButton("ret 100 gfds fdsg fds gfds", 100);
        dia.addButton(5000, "ret 5000");
        dia.setTitle("A title");
        
        int result = dia.show();
        
        System.out.println("result = " + result);
      }
    });
  }
}
